import {
  message,
} from 'antd';
// 处理 页面型时使用
import {browseLogList} from "@/services/browseLog"

export default {
  namespace: 'browseLog',
  state: {
    page_type_list : [
      {
        value: 'scenic',
        name:'景区门票'
      },{
        value: 'traffic',
        name:'交通'
      },{
        value: 'traffic_ship',
        name:'邮轮'
      },{
        value: 'estate',
        name:'房产'
      },{
        value: 'hotel',
        name:'酒店'
      },{
        value: 'travel_note',
        name:'游记'
      },
      {
        value: 'travel_resource',
        name:'旅游资源'
      },
    ],
    checkType : 'scenic'
  },
  effects: {
    * fetch({payload}, {call, put}) {
      console.log("payload=",payload);
      const list = yield call(browseLogList, payload);
      console.log("list=",list);
      yield put({
        type: 'save',
        payload: {
          list: list.list,
          checkType:payload.type,
          pagination: {
            page_size: list.page_size,
            total_pages: list.total_pages,total: list.total_elements,
            page_num: list.page_num,
            current:list.page_num,
          }
        },
      });
    },

  },
  reducers: {
    save(state, action) {
      return {
        ...state,
        ...action.payload,
      };
    },
  }
}